/*
 * IDGenerator.java
 * Implement method to generate PollID
 * Copyright by Axon Active Viet Nam
 * Da Nang
 * All rights reserved.
 */
package com.team.cloudsharing.ultis;

import java.util.Random;

public class IDGenerator {
	public static String randomString(int num) {

		String str01 = "abcdefghijklmnopqrstuvwxyz";
		String str02 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		String str03 = "0123456789";

		StringBuffer strValidBuff = new StringBuffer();
		strValidBuff.append(str01);
		strValidBuff.append(str02);
		strValidBuff.append(str03);
		
		String strValid = strValidBuff.toString(); 
		
		Random random = new Random();

		StringBuffer mystring = new StringBuffer();
		int randnum = 0;
		for (int i = 0; i < num; i++) {
			randnum = random.nextInt(strValid.length());
			mystring.append(strValid.charAt(randnum));
		}

		return mystring.toString().toLowerCase();
	}
}
